package com.css.crm.vo;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "customer-telephone")
public class CustomerTelephoneVo extends AuditTrailVo {

	/** CUST_TEL_ID **/
	private Long custTelId;
	/** CUST_ID **/
	private String custId;
	/** TYPE_CDE **/
	private String typeCde;
	/** CTRY_CDE **/
	private String ctryCde;
	/** AREA_CDE **/
	private String areaCde;
	/** TEL_NBR **/
	private String telNbr;

	@XmlElement
	public Long getCustTelId() {
		return custTelId;
	}

	public void setCustTelId(Long custTelId) {
		this.custTelId = custTelId;
	}

	@XmlElement
	public String getCustId() {
		return custId;
	}

	public void setCustId(String custId) {
		this.custId = custId;
	}

	@XmlElement
	public String getTypeCde() {
		return typeCde;
	}

	public void setTypeCde(String typeCde) {
		this.typeCde = typeCde;
	}

	@XmlElement
	public String getTelNbr() {
		return telNbr;
	}

	public void setTelNbr(String telNbr) {
		this.telNbr = telNbr;
	}

	@Override
	public int compareTo(AuditTrailVo o) {
		CustomerTelephoneVo vo = (CustomerTelephoneVo) o;
		if (vo == null) {
			// if not set original data, default set to modified.
			return 1;
		}
		String custId = this.getCustId() == null ? "" : this.getCustId();
		String typeCode = this.getTypeCde() == null ? "" : this.getTypeCde();
		String ctryCode = this.getCtryCde() == null ? "" : this.getCtryCde();
		String areaCode = this.getAreaCde() == null ? "" : this.getAreaCde();
		String telNbr = this.getTelNbr() == null ? "" : this.getTelNbr();

		String custIdCompareTo = vo.getCustId() == null ? "" : vo.getCustId();
		String typeCodeCompareTo = vo.getTypeCde() == null ? "" : vo.getTypeCde();
		String ctryCodeCompareTo = vo.getCtryCde() == null ? "" : vo.getCtryCde();
		String areaCodeCompareTo = vo.getAreaCde() == null ? "" : vo.getAreaCde();
		String telNbrCompareTo = vo.getTelNbr() == null ? "" : vo.getTelNbr();

		// check if have any field be modified
		int result = 0;
		if (!custId.equals(custIdCompareTo)) {
			result = 1;
		}
		if (!typeCode.equals(typeCodeCompareTo)) {
			result = 1;
		}
		if (!ctryCode.equals(ctryCodeCompareTo)) {
			result = 1;
		}
		if (!areaCode.equals(areaCodeCompareTo)) {
			result = 1;
		}
		if (!telNbr.equals(telNbrCompareTo)) {
			result = 1;
		}
		return result;
	}

	public String getCtryCde() {
		return ctryCde;
	}

	public void setCtryCde(String ctryCde) {
		this.ctryCde = ctryCde;
	}

	public String getAreaCde() {
		return areaCde;
	}

	public void setAreaCde(String areaCde) {
		this.areaCde = areaCde;
	}

}
